<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>库存盘点</title>


    <style>
        .t1 {
            width: 100px;
        }

        .t2 {
            width: 100px;
        }
    </style>

    <script src="http://localhost:10000/js/jquery-1.11.3.min.js"></script>
    <script src="http://localhost:10000/js/pandian.js"></script>

    <!--    <script src="http://localhost:10000/js/pandian2.js"></script>-->
</head>
<body>

<!-- 库存盘点 -->

<div style="border: solid 1px; background-color:aliceblue;  position: absolute;margin-left: 58px;margin-top:27px "
     id="d1" hidden></div>

<form action="/pandian/StartCount.do" id="formpd">

    <table border="1" cellspacing="0">
        <tr>
            <td class="t1">货主</td>
            <td colspan="4" class="t1">
                <input type="text" id="pandian1" name="name" th:value="${session.name}">
            </td>
        </tr>

        <tr>
            <td class="t1">仓库</td>
            <td colspan="4" class="t1">
                <select name="store" id="store">
                    <option value="">--请选择--</option>
                    <option th:each="every:${session.wmsTStores}" th:value="${every.getStoreID()}"
                            th:text="${every.getStoreName()}"
                            th:selected="${every.getStoreID() == session.store}"></option>
                </select></td>
        </tr>

        <tr>
            <td colspan="4" class="t1">
                <input type="hidden" name="pageNum" value="1"/>
                <input type="hidden" name="pageSize" value="5"/>
                <input type="submit" value="开始盘点" id="pandian2">
            </td>
        </tr>

        <tr>
            <td colspan="2"><img src="#" alt=""></td>
        </tr>

    </table>


</form>


<br><br><br>

<table id="div1" border="1" cellspacing="0" th:if="${session.pageInfopandian != null}">

    <tr>
        <td>仓库名称</td>
        <td>货主</td>
        <td>仓位</td>
        <td>托盘</td>
        <td>货物名称</td>
        <td>货物规格</td>
        <td>出库件数</td>
    </tr>

    <tr th:each="every:${session.pageInfopandian.getList()}">
        <td th:text="${every.getStoreName()}"></td>

        <td th:text="${every.getCustName()}" id="custName">
            <!--            <input th:value=" ${every.getCustName()} type="hidden" name="custName" id="custName "/>-->
        </td>

        <td th:text="${every.getSiteCode()}"></td>

        <td th:text="${every.getTrayCode()}"></td>

        <td th:text="${every.getDetailsGoodsName()}"></td>

        <td th:text="${every.getDetailsGoodsSpec()}"></td>

        <td th:text="${every.getDetailsGoodsNum()}"></td>


    </tr>


    <input type="hidden" id="num" th:value="${session.num}"/>
    <input type="hidden" id="size" th:value="${session.size}"/>

    <tr>
        <button th:value="${session.pageInfopandian.getPageNum()>1?session.pageInfopandian.getPageNum()-1:session.pageInfopandian.getPageNum()}"
                onclick="lastpage(this.value)">上一页
        </button>

        <select name="pageSize" id="pageSize" onchange="getpage(this.value)">
            <option value="5" th:selecte d="${session.size == 5}">5</option>
            <option value="10" th:selected="${session.size == 10}">10</option>
            <option value="15" th:selected="${session.size == 15}">15</option>
        </select>

        <button th:value="${session.pageInfopandian.getPageNum()<session.pageInfopandian.getPages()?session.pageInfopandian.getPageNum()+1:session.pageInfopandian.getPageNum()}"
                onclick="lastpage(this.value)">下一页
        </button>

        <!--    <button th:value="${session.pageInfopandian.getPageNum()<session.pageInfopandian.getSize()?session.pageInfopandian.getPageNum()+1:session.pageInfopandian.getPageNum()}"-->
        <!--            onclick="lastpage(this.value)">下一页-->
        <!--    </button>-->
    </tr>

</table>


</body>

<script type="text/javascript">

    $("#formpd").submit(function () {

        var name = $("#pandian1").val();
        var store = $("#store").val();

        if (name == null || name == '') {

            window.alert('请填写货主姓名')
            return false;
        }
        if (store == null || store == '') {
            window.alert('请选择仓库')
            return false;
        }
        return true;
    })


    function getpage(page) {

        var custName = $("#pandian1").val();
        var store = $("#store").val();
        var pageNum = $("#num").val();

        // window.alert(custName + '&' + 'store' + '-' + page + '&' + pageNum);

        window.location = "/pandian/TurnPages.do?name=" + custName + "" +
            "&store=" + store + "&pageNum=" + pageNum + "&pageSize=" + page;

    }

    function lastpage(page) {
        var custName = $("#pandian1").val();
        var store = $("#store").val();
        var pageSize = $("#pageSize").val();
        window.location = "/pandian/TurnPages.do?name=" + custName + "" +
            "&store=" + store + "&pageNum=" + page + "&pageSize=" + pageSize;
    }


</script>


</html>